/**
 * Project: lionbule-other
 * 
 * File Created at 2012-4-7
 * $Id$
 * 
 * Copyright 1999-2100 Alibaba.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Alibaba Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Alibaba.com.
 */
package com.poi;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.List;

/**
 * Store.
 * 
 * @author LionBule 2012-4-7 上午11:14:23
 */
public class Store {
    public void save(List<String> sqls) throws Exception {
        Connection conn = getConn();
        Statement stmt = conn.createStatement();

        for (String s : sqls) {
            stmt.addBatch(s);
        }

        stmt.executeBatch();
        stmt.close();
        conn.close();
    }

    Connection getConn() throws Exception {
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        
        Connection conn = DriverManager.getConnection(
                "jdbc:mysql://10.250.4.98:3306/agds?characterEncoding=utf8",
                "agds", "agds");
        return conn;
    }
}
